package com.yita.fruit.servlets;

import com.yita.fruit.dao.Impl.FruitDaoImpl;
import com.yita.myssm.myspringmvc.ViewBaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/edit.do")
public class EditServlet extends ViewBaseServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String fid = req.getParameter("fid");
        FruitDaoImpl fruitDao = new FruitDaoImpl();
        req.setAttribute("fruit", fruitDao.getFruitById(fid));
        processTemplate("edit", req, resp);
    }
}
